package com.qf.web;

import cn.com.webxml.MobileCodeWSSoap;
import com.qf.bean.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * IntelliJ IDEA -> person
 * 2019/11/29 11:20
 *
 * @author zmyao
 * 别看，我是渣渣。
 *
 */
@Controller
public class PhoneController  {
@Autowired
private MobileCodeWSSoap mobileCodeWSSoap;
    @RequestMapping("/getPhoneAddress")
    @ResponseBody
    public Message  getPhoneAddress(String phone){
        String mobileCodeInfo = mobileCodeWSSoap.getMobileCodeInfo(phone, "");
        Message message = new Message();
        if ("手机号码错误".equals(mobileCodeInfo) || "没有此号码记录".equals(mobileCodeInfo )){
         message.setAddress(mobileCodeInfo);
        }
        else {
            String[] strs = mobileCodeInfo.split("：");
            message.setAddress(strs[1]);
        }
        return  message;
    }
}
